https://minecraftcommands.github.io/wiki/questions/linkentity
https://minecraftcommands.github.io/wiki/questions/storeinventory.html

I basically copied these commands from this website to my datapack. If you, the author, is reading this, thank you very much for an awesome website.

For amateur datapack writers like me, want to know how things work, I'll try to explain every steps with my broken English. Thank your for downloading this datapack